package com.bawei.home.callback

import androidx.recyclerview.widget.DiffUtil
import com.bawei.common.entity.SimpleVideoEntity

/**
 * Author: Jason Zhang
 * Date: 2024/9/23
 * Desc: 自定义Diff回调类
 */
class ItemDiffCallback (
    private val oldList: List<SimpleVideoEntity>,
    private val newList: List<SimpleVideoEntity>,
): DiffUtil.Callback() {

    override fun getOldListSize(): Int  = oldList.size

    override fun getNewListSize(): Int = newList.size

    override fun areItemsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = oldList[oldItemPosition].id == newList[newItemPosition].id

    override fun areContentsTheSame(oldItemPosition: Int, newItemPosition: Int): Boolean = oldList[oldItemPosition] == newList[newItemPosition]


}